import waves from "@/directive/waves";
import Pagination from "@/components/Pagination";
import { mapGetters } from 'vuex';
import { getUserListApi } from './system-settings.service';
import EditSystem from './components/edit-system/edit-system'
export default {
  name: 'system-settings',
  components: { Pagination, EditSystem },
  directives: { waves },
  data() {
    return {
      totalNum: 0, // 数据总数
      pageNum: 1, // 页数
      recordNum: 20, // 分页组件默认的页数, 分页里的select默认10, 20, 50
      data: [], // 列表数据
      loading: true, // table loading
      editDialogVisible: false, // 编辑详情模态窗
      /* structuresTreeData: [], // 组织架构
      defaultProps: { // 部门树变量
        children: "children",
        label: "text",
        value: 'id',
        checkStrictly: true
      }, */
      selectId: ''
    }
  },
  computed: {
    ...mapGetters([
      'codesCheck'
    ])
  },
  created() {
    this.getDataList();
  },
  methods: {
    // 获取列表
    getDataList() {
      this.loading = true;
      const params = {
        pageNum: this.pageNum,
        recordNum: this.recordNum
      }
      getUserListApi(params).then(res => {
        this.totalNum = Number(res.dataCount);
        this.data = res.data;
        this.loading = false;
      });
    },

    // 刷新
    reload() {
      this.pageNum = 1;
      this.getDataList();
    },

    // 打开新建、编辑窗体
    openCreateOrEditDialog(row) {
      this.selectData = row;
      this.editDialogVisible = true;
    },

    // 关闭新建、编辑窗体
    closeCreateOrEditDialog() {
      this.editDialogVisible = false;
    }
  }
}
